﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Helpers.Converters
{
    public class MultipleVisibilityToVisibility : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter,
            System.Globalization.CultureInfo culture)
        {
            switch (parameter.ToString().ToUpper())
            {
                case "ANYVISIBLE":
                    foreach (object value in values)
                    {
                        if ( value != DependencyProperty.UnsetValue && (Visibility)value == Visibility.Visible)
                            return Visibility.Visible;
                    }

                    break;
            }

            return Visibility.Collapsed;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter,
            System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

}